<style lang="less" scoped>
    .cont_scroll_box {
        padding-bottom: 1.1rem;
        height: 100%;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;

        .detail_box {

            /*商品价格信息*/
            .detail_prise {
                display: flex;
                background: #fff;
                padding: 0 0.32rem;

                .prise_box {
                    flex-direction: row;
                    margin-top: 0.3rem;
                    width: 50%;

                    h2 {
                        color: #d63539;
                        font-size: 0.5rem;
                        float: left;
                        font-weight: normal;
                    }

                    span {
                        font-size: 0.3rem;
                        float: left;
                        margin-top: 0.15rem;
                        margin-left: 0.1rem;
                        text-decoration: line-through;
                        color: #555858;
                    }

                }
                .people_num {
                    width: 50%;
                    flex-direction: row;

                    h3 {
                        float: right;
                        font-size: 0.26rem;
                        margin-top: 0.44rem;
                        color: #666666;
                        font-weight: normal;
                    }

                }
            }
            /*商品详细信息*/
            .product_information {
                background: #fff;

                h1 {
                    font-size: 0.29rem;
                    padding: 0.21rem 0.32rem 0.29rem;
                    line-height: 1.5;
                }

            }
            /*优惠信息*/
            .product_offer {
                padding: 0.27rem 0.32rem;
                background: #fafafa;

                .coupon {
                    overflow: hidden;
                    .voucher {
                        float: left;
                        width: 0.3rem;
                        height: 0.3rem;
                        background: url('../../../assets/img/voucher.png') no-repeat center center;
                        background-size: 100% 100%;
                    }
                    span {
                        font-size: 0.25rem;
                        float: left;
                        padding-top: 0.06rem;
                        margin-left: 0.11rem;
                        color: #525355;

                    }

                }
                .shipping {
                    padding-top: 0;
                    padding-bottom: 0;
                    overflow: hidden;
                    .ship_pic {
                        float: left;
                        width: 0.3rem;
                        height: 0.3rem;
                        background: url('../../../assets/img/ship.png') no-repeat center center;
                        background-size: 100% 100%;
                    }
                    .ship_two {
                        float: left;
                        padding-right: 0.25rem;
                        margin-top: 0.18rem;
                        &:last-of-type {
                            padding-right: 0;
                        }
                        span {
                            font-size: 0.25rem;
                            float: left;
                            padding-top: 0.06rem;
                            margin-left: 0.11rem;
                            color: #525355;

                        }

                    }
                }
            }

            /*拼单信息*/
            .fight_single {
                margin-top: 0.16rem;
                padding: 0.3rem 0.32rem;
                background: #fff;

                .fight_title {
                    display: flex;
                    justify-content: space-between;
                    align-items: flex-end;
                    .left {
                        width: 50%;
                        flex-direction: row;
                        font-size: 0.29rem;
                        color: #131514;

                    }

                    .right {
                        width: 50%;
                        flex-direction: row;
                        text-align: right;
                        line-height: 0.3rem;
                        span {
                            /*float: right;*/
                            font-size: 0.26rem;
                            color: #9c9c9c;
                            i {
                                margin-left: 0.06rem;
                            }
                        }

                        .v-transfer-dom {

                            .vux-popup-dialog {
                                margin: 3rem 1rem;
                            }

                        }
                    }
                }
                .fight_cont {

                    .fight_list {
                        display: flex;
                        margin-top: 0.24rem;

                        .fight_left {
                            width: 50%;
                            flex-direction: row;

                            img {
                                width: 0.93rem;
                                height: 0.93rem;
                                border-radius: 50%;
                                margin: 0.14rem 0;
                                float: left;
                            }

                            span {
                                float: left;
                                margin-top: 0.47rem;
                                margin-left: 0.21rem;
                                font-size: 0.29rem;
                                color: #131514;
                                max-width: 50%;
                                overflow: hidden;
                                white-space: nowrap;
                                text-overflow: ellipsis;
                            }

                        }
                        .fight_right {
                            flex-direction: row;
                            width: 50%;
                            margin: 0.33rem 0;

                            button {
                                float: right;
                                width: 1.46rem;
                                height: 0.6rem;
                                border-radius: 1rem;
                                background: #e94f4f;
                                color: #fff;
                                font-size: 0.28rem;
                            }

                            .fight_txt {
                                margin-top: 0.08rem;

                                h2 {
                                    font-size: 0.26rem;
                                    color: #131514;
                                    font-weight: normal;
                                    span {
                                        font-weight: bold;
                                    }
                                }

                                p {
                                    font-size: 12px;
                                    color: #585c5b;
                                    margin-top: 0.12rem;
                                }

                            }
                        }
                    }
                }
            }
            /*推荐*/
            .recommend_list {
                background: #fff;
                margin-top: 0.16rem;

                h1 {
                    font-size: 0.3rem;
                    color: #e53221;
                    text-align: center;
                    padding: 0.44rem 0 0.04rem;
                    margin-bottom: 0.1rem;
                }

                .product {
                    display: flex;
                    flex-direction: row;
                    flex-wrap: wrap;

                    .product_list_box {
                        width: 33%;

                        .product_list {
                            background: #fff;
                            height: 3.8rem;
                            position: relative;
                            margin: 0.24rem 0.03rem 0;

                            img {
                                width: 2.43rem;
                                height: 2.43rem;
                                display: block;
                                margin: 0 auto;
                                border: 1px solid #f1f1f1;
                            }

                            h3 {
                                margin: 0.06rem;
                                text-align: left;
                                font-size: 0.24rem;
                                font-weight: normal;
                                line-height: 0.36rem;
                                display: -webkit-box;
                                /*! autoprefixer: off */
                                -webkit-box-orient: vertical;
                                /* autoprefixer: on */
                                -webkit-line-clamp: 2;
                                overflow: hidden;
                            }

                            .price_num {
                                height: 0.6rem;
                                display: flex;
                                justify-content: space-between;
                                align-items: center;
                                padding: 0 0.06rem 0 0.06rem;
                                position: absolute;
                                bottom: 0;
                                left: 0;
                                width: 100%;
                                line-height: 0.36rem;
                                p {
                                    width: 50%;
                                    overflow: hidden;
                                    white-space: nowrap;
                                    text-overflow: ellipsis;
                                }

                                .price {
                                    color: #d43428;
                                    font-size: 0.32rem;
                                    font-weight: bold;
                                    span {
                                        font-size: 12px;
                                    }

                                }
                                .num {
                                    text-align: right;
                                    color: #9b9b9b;
                                    font-size: 0.24rem;
                                }

                            }
                        }
                    }
                }
            }
            /*评价*/
            .evaluation_box {
                margin-top: 0.16rem;
                padding-top: 0.3rem;
                background: #fff;

                .evaluation_list {

                    .evaluation_title {
                        display: flex;
                        padding: 0 0.32rem 0.28rem;
                        border-bottom: 1px solid #eeeeee;

                        .left {
                            width: 50%;
                            flex-direction: row;
                            font-size: 0.29rem;
                            color: #131514;

                            span {
                                font-size: 0.22rem;
                                color: #e02c1f;
                            }

                        }
                        .right {
                            width: 50%;
                            flex-direction: row;

                            span {
                                float: right;
                                font-size: 0.26rem;
                                color: #9c9c9c;

                            }

                        }
                    }
                    .evaluation_label {
                        padding: 0.07rem 0.32rem 0;
                        display: flex;
                        flex-wrap: wrap;

                        span {
                            flex-direction: row;
                            display: inline-block;
                            padding: 0.16rem 0.2rem;
                            background: #fceae8;
                            border-radius: 6px;

                            color: #131514;
                            margin-right: 0.2rem;
                            margin-top: 0.22rem;
                        }

                    }
                    .list_box {
                        padding: 0 0.3rem;
                        background: #fff;
                        & >div{
                            padding-bottom: 0.2rem;
                            border-bottom: 1px solid #efefef;
                            &:last-child{
                                padding-bottom: 0;
                                border-bottom: none;
                            }
                        }
                        .list_num {

                            .list_title {
                                display: flex;
                                flex-direction: row;
                                flex-wrap: nowrap;

                                .left {
                                    width: 50%;

                                    img {
                                        width: 0.52rem;
                                        height: 0.52rem;
                                        border-radius: 50%;
                                        float: left;
                                        margin-top: 0.32rem;
                                    }

                                    span {
                                        float: left;
                                        margin-top: 0.46rem;
                                        margin-left: 0.14rem;
                                        font-size: 0.28rem;
                                        color: #131614;

                                    }

                                }
                                .right {
                                    width: 50%;

                                    span {
                                        float: right;
                                        margin-top: 0.47rem;
                                        font-size: 0.26rem;
                                        color: #989898;
                                    }

                                }
                            }
                            .list_txt {
                                margin-top: 0.24rem;
                                font-size: 0.28rem;
                                color: #555555;
                                line-height: 0.39rem;
                            }

                        }
                        .list_image {
                            margin-top: 0.15rem;
                            display: flex;
                            justify-content: flex-start;
                            align-items: center;
                            flex-wrap: wrap;
                            > div {
                                width: 30%;
                                height: 2rem;
                                margin-left: 2%;
                            }
                            img {
                                width: 100%;
                                height: 2rem;
                            }

                        }
                        .list_model {
                            display: flex;
                            flex-direction: row;
                            flex-wrap: nowrap;
                            color: #a4a4a4;
                            font-size: 0.25rem;
                            padding: 0.16rem 0 0.28rem;

                            .model_style {
                                margin-left: 0.3rem;
                            }

                        }
                    }
                    .view_all {
                        border-top: 1px solid #efefef;
                        margin-top: 0.2rem;
                        p {
                            padding: 0.27rem 0;
                            text-align: center;
                            font-size: 0.29rem;
                            color: #323232;
                        }

                    }
                }
            }
            /*商品详情图片*/
            .product_pic_box {
                margin-top: 0.16rem;
                background: #fff;

                .pic_title {
                    display: flex;
                    padding: 0.32rem;
                    border-bottom: 1px solid #eeeeee;

                    .left {
                        width: 50%;
                        flex-direction: row;
                        font-size: 0.29rem;
                        color: #131514;

                    }

                    .right {
                        width: 50%;
                        flex-direction: row;

                        span {
                            float: right;
                            font-size: 0.26rem;
                            color: #9c9c9c;

                        }

                    }
                }
                .pic_box {
                    img {
                        display: block;
                        width: 100%;
                        height: auto;
                        pointer-events: auto;
                    }
                }
            }
        }
    }

    .v-transfer-dom > .vux-popup-dialog.vux-popup-top {
        width: 80.53%;
        position: absolute;
        left: 9.73%;
        top: 15%;
        border-radius: 0.2rem;
        background: #fff;

        .vux-scrollable {

            .show_header_title {

                h1 {
                    margin: 0.42rem 0;
                    font-size: 0.34rem;
                    color: #333;
                    text-align: center;
                }

                span {
                    width: 0.3rem;
                    height: 0.3rem;
                    background: url('../../../assets/img/close.png') no-repeat center center;
                    background-size: 100% 100%;
                    position: absolute;
                    top: 0.3rem;
                    right: 0.3rem;
                }

            }
            .show_list {
                width: 100%;
                height: 7rem;
                overflow-y: scroll;

                .list_cont {
                    display: flex;
                    border-top: 1px solid #f5f5f5;

                    .fight_left {
                        width: 70%;
                        display: flex;
                        flex-direction: row;
                        flex-wrap: nowrap;
                        margin: 0.24rem 0 0 0.22rem;

                        img {
                            width: 0.93rem;
                            height: 0.93rem;
                            border-radius: 50%;
                            margin: 0.14rem 0;
                        }

                        .list_time {
                            margin-top: 0.3rem;
                            margin-left: 0.25rem;
                            color: #131514;
                            font-weight: bold;
                            font-size: 0.28rem;

                            .name {
                                color: #333;
                                margin-bottom: 0.16rem;
                                max-width: 50%;
                                overflow: hidden;
                                white-space: nowrap;
                                text-overflow: ellipsis;
                            }

                            .time {
                                color: #909090;
                            }

                        }
                    }
                    .fight_right {
                        flex-direction: row;
                        width: 30%;
                        margin: 0.47rem 0.22rem 0 0;

                        button {
                            float: right;
                            width: 1.46rem;
                            height: 0.6rem;
                            border-radius: 1rem;
                            background: #d63539;
                            color: #fff;
                            font-size: 0.29rem;
                        }

                        .fight_txt {
                            margin-top: 0.08rem;
                            font-size: 0.26rem;
                            h2 {
                                color: #131514;
                                font-weight: normal;
                            }

                        }
                    }
                }
            }
        }
    }
</style>
<template>
    <div class="cont_scroll_box">
        <swiper height="7.5rem" dots-class="custom-bottom" dots-position="right">
            <swiper-item style="width: 100%;height: 100%" v-for="(item, index) in good.rollImages" :key="index" @click.native="productImageClick(good.rollImages,index)">
                <img style="width: 100%;height: 100%;" :src="item.img" alt="">
            </swiper-item>
        </swiper>
        <!-- 详情信息 -->
        <div class="detail_box">
            <!-- 商品价格信息 -->
            <div class="detail_prise">
                <div class="prise_box">
                    <h2><i style="font-size: 0.4rem;font-style: normal;">￥</i>{{good.minSellPrice}}
                    </h2>
                    <span><i style="font-size: 0.24rem;font-style: normal;">￥</i>{{good.minOriginalPrice}}</span>
                </div>
                <div class="people_num">
                    <h3 v-if="isCollage">已拼{{good.sales}}件·{{good.leastCount}}人拼单</h3>
                    <h3 v-else>销量{{good.sales || 0}}件</h3>
                </div>
            </div>
            <!-- 商品详细信息 -->
            <div class="product_information">
                <h1><i :class="good.type == '3' || good.type == '1' ?'mall_proprietary_icon':good.type == '5'?'province_recommend_icon':''"></i>{{good.name}}</h1>
            </div>
            <!-- 优惠信息 -->
            <div class="product_offer" v-show="good.promiseInfoList">
                <!--<div class="coupon">-->
                <!--<i class="voucher"></i>-->
                <!--<span>满1000元减50元</span>-->
                <!--</div>-->
                <div class="shipping" @click="updatePromiseInfoListShow">
                    <div class="ship_two" v-for="(v, i) in good.promiseInfoList" v-if="i < 3">
                        <i class="ship_pic" :style="{backgroundImage: v.promiseUrl}"></i>
                        <span>{{v.promiseDescribe}}</span>
                    </div>
                </div>
            </div>
            <!--TODO 拼单-->
            <div class="fight_single" v-if="isCollage">
                <div class="fight_title">
                    <p class="left">{{product_open == null ? 0 :product_open.length}}人在拼单</p>
                    <p class="right">
                        <span @click="product_open == null || product_open.length == 0 ? '' :show_list()"
                              v-show="product_open && product_open.length > 0">查看更多 <i
                                class="right_icon"></i>
                        </span>
                    </p>
                </div>
                <!--所有的拼单-->
                <div v-transfer-dom>
                    <popup v-model="show16" position="top" should-scroll-top-on-show style="height:8.14rem;">
                        <div @click="show16 = false" scrollable class="vux-scrollable">
                            <div class="show_header_title">
                                <h1>正在拼单</h1>
                                <span @click="show16 = false"></span>
                            </div>
                            <div class="show_list">
                                <div class="list_cont" v-for="open in product_open"
                                     v-on:click="gotoBuying(open)">
                                    <div class="fight_left">
                                        <img :src="open.userHeadImgUrl ? open.userHeadImgUrl : 'https://files.shbs008.com/images/headImg/defaultHeadImg.png'"
                                             alt="">
                                        <div class="list_time">
                                            <p class="name">{{open.userName}}</p>
                                            <p class="time">剩余{{comJS.updateTime(open.restTime)}}</p>
                                        </div>
                                    </div>
                                    <div class="fight_right">
                                        <button>去拼单</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </popup>
                </div>
                <!--所有的拼单结束-->
                <!--拼单列表展示两个-->
                <div class="fight_cont">
                    <div v-for="(open,index) in product_open" v-if="index < 2"
                         v-on:click="gotoBuying(open)"
                         :class="index === product_open.length - 1 ? 'fight_list': 'fight_list vux-1px-b' ">
                        <div class="fight_left">
                            <img :src="open.userHeadImgUrl ? open.userHeadImgUrl : 'https://files.shbs008.com/images/headImg/defaultHeadImg.png'"
                                 alt="">
                            <span>{{open.userName}}</span>
                        </div>
                        <div class="fight_right">
                            <button>去拼单</button>
                            <div class="fight_txt">
                                <h2>还差<span style="color:#d63539">{{open.restNeedNum}}人</span>拼成</h2>
                                <p>剩余{{comJS.updateTime(open.restTime)}}</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!--商品 直接选择规格-->
            <div class="evaluation_box" v-else>
                <div class="evaluation_list">
                    <div class="evaluation_title" @click="isShare ? openApp() : choiceSize()">
                        <p class="left">选择规格</p>
                        <p class="right">
                            <span><i class="right_icon"></i></span>
                        </p>
                    </div>
                </div>
            </div>
            <!-- 推荐 -->
            <div class="recommend_list">
                <h1>为您推荐</h1>
                <div class="product">
                    <div class="product_list_box"
                         @click="isShare ? openApp() : updateProduct(info)" v-for="(info, i) in tuijianArr"
                         v-if="i < 6">
                        <a href="javascript:void(0)">
                            <div class="product_list">
                                <img v-lazy="{src:info.productInfo.mainImage}" alt="">
                                <h3><i :class="good.type == '3' || good.type == '1' ?'mall_proprietary_icon':good.type == '5'?'province_recommend_icon':''"></i>{{info.productInfo.name}}</h3>
                                <div class="price_num">
                                    <p class="price"><span>￥</span>{{info.minSellPrice}}</p>
                                    <p class="num">{{isCollage ? '已拼' : '已售'}}{{info.sales}}件</p>
                                </div>
                            </div>
                        </a>
                    </div>
                </div>
            </div>
            <!-- 评价 -->
            <div class="evaluation_box eval">
                <div class="evaluation_list">
                    <div class="evaluation_title">
                        <p class="left">商品评价({{queryJudge.total}}) &nbsp;
                            <!--<span>好评率{{queryJudge.feedback}}%</span>-->
                        </p>
                        <p class="right" v-show="queryJudge.list && queryJudge.list.length > 0">
                            <span @click="isShare ? openApp() : getmore()">查看更多 <i class="right_icon"></i></span>
                        </p>
                    </div>

                    <!--TODO YLB 评价标签-->
                    <!--<div class="evaluation_label">
                        <span>手机不错(127)</span>
                        <span>速度快(74)</span>
                        <span>手感好(73)</span>
                    </div>-->
                    <!--              12            -->
                    <div class="list_box">
                        <div v-for="(item, index) in queryJudge.list" v-if="index < 2">
                            <div class="list_num">
                                <div class="list_title">
                                    <div class="left">
                                        <img v-lazy="{src: item.headImgUrl}" alt="头像">
                                        <span>{{item.nickname}}</span>
                                    </div>
                                    <div class="right">
                                        <span>{{item.createTime}}</span>
                                    </div>
                                </div>
                                <p class="list_txt">{{item.content}}</p>
                            </div>
                            <div class="list_image">
                                <div v-for="(v, i) in item.imgList" @click="show(i ,index)" v-if="i<2">
                                    <img class="previewer-demo-img" :src="v.src" width="100" :ref="'img'+ index">
                                </div>
                                <div v-transfer-dom>
                                    <previewer :list="item.imgList" ref="previewer" :options="options"
                                               @on-index-change="logIndexChange"></previewer>
                                </div>
                            </div>
                        </div>

                    </div>
                    <div class="view_all" v-show="queryJudge.list && queryJudge.list.length > 0"
                         @click="isShare ? openApp() : getmore()">
                        <p>查看全部评价</p>
                    </div>
                </div>
            </div>
            <!-- 商品详情图片 -->
            <div class="product_pic_box">
                <div class="pic_title">
                    <p class="left">商品详情</p>
                    <p class="right">
                        <!--<span>查看更多 <i class="right_icon"></i></span>-->
                    </p>
                </div>
                <div class="pic_box">
                    <img v-for="(v,i) in String(good.detailImages).split(',')" v-lazy="{src: v}" alt="" v-on:click="productImageClick(good.detailImages,i)">
                </div>
            </div>
            <load-more :show-loading="false" tip='我是有底线的' background-color="#fbf9fe"></load-more>
        </div>
    </div>
</template>
<script>
    import {mapActions, mapState} from 'vuex'
    import {
        Flexbox,
        FlexboxItem,
        Actionsheet,
        Swiper,
        GroupTitle,
        SwiperItem,
        Popup,
        Group,
        Cell,
        XButton,
        XSwitch,
        XAddress,
        ChinaAddressData,
        LoadMore,
        Previewer,
        XImg,
        TransferDom
    } from 'vux'
    import {photoSwipe} from '../../../plugin'

    export default {
        name: 'product_details_cont',
        directives: {
            TransferDom
        },
        components: {
            Flexbox,
            FlexboxItem,
            Actionsheet,
            Swiper,
            GroupTitle,
            SwiperItem,
            Previewer,
            XImg,
            Popup,
            Group,
            Cell,
            XButton,
            XSwitch,
            XAddress,
            ChinaAddressData,
            LoadMore
        },
        data: function () {
            return {
                queryJudge: {},
                tuijianArr: [],
                isCollage: this.$route.query.type == 1 ? true : false,
                isShare: this.$route.query.sharePage == 1 ? true : false,
                show16: false,  //  拼单列表弹窗
                product_open: [], // 拼单用户列表
                timer: null,
                options: {
                    getThumbBoundsFn(index) {
                        // find thumbnail element
                        let thumbnail = document.querySelectorAll(".previewer-demo-img")[
                            index
                            ];
                        // get window scroll Y
                        let pageYScroll =
                            window.pageYOffset || document.documentElement.scrollTop;
                        // optionally get horizontal scroll
                        // get position of element relative to viewport
                        let rect = thumbnail.getBoundingClientRect();
                        // w = width
                        return {x: rect.left, y: rect.top + pageYScroll, w: rect.width};
                        // Good guide on how to get element coordinates:
                        // http://javascript.info/tutorial/coordinates
                    }
                },
            }
        },
        props: {
            good: {
                type: Object,
                default: {}
            },
            recommendCode: {
                type: String
            },
            /*tuijianArr: {
                type: Array,
                default:() => {
                    return []
                }
            }*/
        },
        activated() {
            this.init()
            if (this.isCollage) {
                this.displayOpened()
            }
            // this.getTemplateList()/**/
        },
        deactivated() {
            clearInterval(this.timer)
        },
        methods: {
            init() {
                this.queryJudge = {}
                this.timer = null
                this.getQueryJudge()
                this.isCollage = this.$route.query.type == 1 ? true : false
                this.isShare = this.$route.query.sharePage == 1 ? true : false
            },
            logIndexChange(arg) {
                console.log(arg);
            },
            show(index, idx) {
                var img = this.$refs['img' + idx]
                var items = []
                img.forEach((v, i) => {
                    items.push(v.src)
                })
                if(this.comJS.isAndroid() ? this.interactive.versionName.versionName >= 23 : this.interactive.versionName.versionName >= "1.1.3"){
                    let str = ''
                    items.forEach((v,i) => {
                        str += v;
                        if(i != items.length - 1){
                            str += ','
                        }
                    })
                    console.log(str)
                    this.Interactive.productImageClick(str,index)
                }else{
                    photoSwipe(items[index], items)
                }
            },
            imgLoad(img) {
                var newImg = document.createElement('img')
                newImg.src = img.src
                img.w = newImg.width
                img.h = newImg.height
                return img
            },
            updateProduct(info) {
                //  更换商品详情
               /* this.$router.replace({
                    path: '/home/product_details',
                    query: {templateId: info.templateId, type: info.type}
                })*/
               if(this.$route.query.from == 'App'){
                   this.$router.replace({
                       path: '/home/product_details',
                       query: {templateId: info.templateId, type: info.type,from: 'App'}
                   })
               } else {
                   this.$router.replace({
                       path: '/home/product_details',
                       query: {templateId: info.templateId, type: info.type}
                   })
               }

                this.init()
                this.$emit('update')
            },
            //获取商品开单列表
            displayOpened() {
                this.$ajax.displayOpened({templateId: this.$route.query.templateId})
                    .then(res => {
                        this.product_open = res.body.content
                        if (this.product_open && this.product_open.length) {
                            this.timer = setInterval(() => {
                                this.product_open.forEach((v, i) => {
                                    if (v.restTime <= 0) {
                                        return;
                                    }
                                    v.restTime--
                                    if (v.restTime == 0) {
                                        this.product_open.splice(i, 1)
                                    }
                                    // console.log(this.comJS.updateTime(this.product_open[0].restTime))
                                })
                            }, 1000)
                        } else {
                            return;
                        }
                    })
            },
            gotoBuying(open) {  //  去拼单页面
                if (open.userId == this.user.userId) {
                    this.$router.push({
                        path: '/collage/wait',
                        query: {orderId: open.orderId, templateId: this.$route.query.templateId}
                    })
                } else {
                    this.$router.push({
                        path: '/collage/join',
                        query: {orderId: open.orderId, templateId: this.$route.query.templateId}
                    })
                }
            },
            show_list() {
                if (this.isShare) {
                    this.openApp()
                } else {
                    this.show16 = true
                }
            },
            //获取产品评价
            getQueryJudge() {
                this.$ajax.queryJudge({templateId: this.$route.query.templateId})
                    .then((res) => {
                        if (res.body.content) {
                            this.queryJudge = res.body.content.judges
                            this.queryJudge.feedback = res.body.content.feedback

                            this.queryJudge.list.forEach((value, i) => {
                                if(!value.headImgUrl || value.headImgUrl == null){
                                    value.headImgUrl = 'https://files.shbs008.com/images/headImg/defaultHeadImg.png'
                                }
                                this.queryJudge.list[i].imgList = [];
                                if (value.images) {
                                    value.images.split(',').forEach((v) => {
                                        var a = {}
                                        a.msrc = v
                                        a.src = v
                                        this.queryJudge.list[i].imgList.push(a)
                                    })
                                }


                            })
                        }
                    })
            },
            //  查看更多评价
            getmore() {
                this.$router.push({path: '/home/evaluation', query: {templateId: this.$route.query.templateId}})
            },
            //获取为您推荐列表
            getTemplateList() {
                console.log(this.$props, '1')
                this.$ajax.searchGoods({
                    pageNum: 1,
                    pageSize: 10,
                    goodsName: '',
                    category: this.recommendCode || null,
                    orderBy: 'createTime',
                    orderType: 'desc',
                    goodsType: this.$route.query.type
                })
                    .then(res => {
                        this.tuijianArr = res.body.content.list
                    })
            },
            getPromotionTemplatesDetailInfoByTemplateId () {
                this.$ajax.getPromotionTemplatesDetailInfoByTemplateId({templateId: this.$route.query.templateId})
                    .then(res => {
                        this.tuijianArr = res.body.content.recommendList
                    })
            },
            //  选则规格
            choiceSize() {
                this.$emit('choiceSize')
            },
            openApp() {
                this.comJS.openApp()
            },
            productImageClick(arr,index){
                if (typeof arr != "string"){
                    let a = arr
                    arr = ''
                    a.forEach((v,i)=>{
                        arr += v.img
                        if(i != a.length -1){
                            arr += ','
                        }
                    })
                }
                this.Interactive.productImageClick(arr,index.toString())
            },
            updatePromiseInfoListShow () {
                // this.$emit('updatePromiseInfoListShow', true)
            }
        },
        watch: {
            '$props.recommendCode': function (v) {
                this.getTemplateList()
            }
        },
        computed: mapState({user: state => state.user,interactive: state => state.interactive})
    }
</script>

